import React, { Component } from 'react'
import BScroll from 'better-scroll'
// betterscroll 最外层得盒子如果要横着滚，子元素得宽要超过父元素得宽，子元素有且只有一个
 class Myscroll1 extends Component {
 componentDidMount(){
     let {direction} = this.props
     setTimeout(()=>{
         this.bs = new BScroll(`.${direction}`,{
             scrollX:direction =="heng",
             scrollY:direction == "shu"
         })
     },200)
 }
  render() {
    return (

      <div className={this.props.direction}>
          {this.props.children} 
      </div>
    )
  }
}

export default Myscroll1